package com.ysr.service;

import com.ysr.pojo.PayMent;
import com.ysr.result.CommonResult;
import feign.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.*;

@ComponentScan
@FeignClient(value = "ysr-payment")
public interface PayMentService {

    @PostMapping("/payment/create")
    CommonResult create(PayMent payment);

    @GetMapping("/payment/get/{id}")
    CommonResult queryById(@PathVariable("id") Long id);

    @PostMapping("/payment/add")
    CommonResult add(PayMent payMent);

    @GetMapping("/payment/queryPayMentById")
    CommonResult queryPayMentById(@RequestParam(value = "id") Long id);

    //调用生产者微服务名称为ysr-payment下边的模拟超时的接口
    @GetMapping("/payment/feign/timeout")
    public String PaymentFeignTimeOut() throws InterruptedException;

    /**
     * 正常访问
     *
     * @param id
     * @return
     */
    @GetMapping("/payment/hystrix/ok/{id}")
    String paymentInfo_OK(@PathVariable("id") Integer id);

    /**
     * 超时访问
     *
     * @param id
     * @return
     */
    @GetMapping("/payment/hystrix/timeout/{id}")
    String paymentInfo_TimeOut(@PathVariable("id") Integer id);

}
